import React from 'react';
import {
  Form,
  Drawer,
  Tooltip,
} from 'antd';

import DescriptionList from '@/components/DescriptionList';

const { Description } = DescriptionList;
import styles from '../UserManage.less';

// 查看详情
const DescView = Form.create()(props => {
  const { lookDescView, handleLookDesc, selectedRows } = props;
  const platform = (val) => {
    if (val === 1) {
      return 'app';
    } else if (val === 3) {
      return 'pc';
    } else {
      return '全部';
    }
  };
  const showhtml = (record) => {
    let html = { __html: record };
    return <div dangerouslySetInnerHTML={html}></div>;
  };
  const aa=()=>{
    console.log(111);
  }
  return (
    <Drawer
      width={640}
      destroyOnClose
      title="文章信息"
      style={{
        overflow: 'auto',
      }}
      visible={lookDescView}
      closable={false}
      onClose={() => handleLookDesc(false, [])}>
      <DescriptionList size="large" style={{ marginBottom: 32 }} col="1">
        <Description term="标题">{selectedRows.title}</Description>
        <Description term="副标题">{selectedRows.subTitle}</Description>
        <Description term="图片">{<a target={'_blank'} href={selectedRows.img}>
          <img className={styles.brandLogo} src={selectedRows.img}
               alt=""/></a>}</Description>
        <Description term="状态">{selectedRows.status === 1 ? '启用' : '停用'}</Description>
        <Description term="发布平台">{platform(selectedRows.platform)}</Description>
        <Description term="创建人">{selectedRows.createName}</Description>
        <Description term="发布时间">{selectedRows.publishTime}</Description>
        <Description term="创建时间">{selectedRows.createTime}</Description>
      </DescriptionList>
      <Description term="内容">{showhtml(selectedRows.context)}</Description>

    </Drawer>
  );
});

export default DescView;
